﻿<!-- #include file="../Include/Admin_Onlogin.asp" -->
<%
Data_Name = "Label"
strFileName = "Admin_Label.asp"
Dim sqlAuth, rsAuth, PurviewID
sqlAuth = "Select AuthID From Admin_Auth Where href='Admin/" & strFileName & "' Order By sort Asc,AuthID Asc"
Call Exec(rsAuth,sqlAuth,2)
If rsAuth.BOF And rsAuth.EOF Then
	PurviewID = 0
Else
	PurviewID = rsAuth(0)
	CheckPurview PurviewID,0
End If
rsAuth.Close
Set rsAuth = Nothing
Select Case Action
Case "AddStat"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Label/Add' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call Add()
Case "AddDyna"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Label/Add' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call AddDyna()
Case "AddDyna2"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Label/Add' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call AddDyna2()
Case "SaveAdd"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Label/Insert' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call Save()
Case "Modify"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Label/Edit' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call Modify()
Case "SaveModify"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Label/Update' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call Save()
Case "ListOrder"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Label/Order' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call ListOrder()
Case "Del"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Label/Del' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
    Call DelLabel()
Case Else
    Call Main()
End Select
If FoundErr = True Then
    Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Call CloseConn()

Sub Main()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		ListType = Code_CLng(Trim(Code_Form("ListType")))
		ClassType = ReplaceBadChar(Trim(Code_Form("ClassType")))
		sqlLabel = "Select * From ["&Data_Name&"] Where LabelType=" & ListType
		If ClassType <> "" Then sqlLabel = sqlLabel & " And LabelClass='" & ClassType & "'"
		sqlLabel = sqlLabel & " Order By Priority Asc,LabelID Desc"
		Call Exe_Conn(rsLabel,sqlLabel,1)
		i = 0
		If rsLabel.BOF And rsLabel.EOF Then
			data = ""
		Else
			If Request("Page") <> "" Then
				CurrentPage = Code_CLng(Request("Page"))
			Else
				CurrentPage = 1
			End If
			MaxPerPage = Code_CLng(Trim(Request("limit")))
			If MaxPerPage <= 0 Then MaxPerPage = 10
			totalPut = rsLabel.RecordCount
			If CurrentPage < 1 Then
				CurrentPage = 1
			End If
			If (CurrentPage - 1) * MaxPerPage > totalPut Then
				If (totalPut Mod MaxPerPage) = 0 Then
					CurrentPage = totalPut \ MaxPerPage
				Else
					CurrentPage = totalPut \ MaxPerPage + 1
				End If
			End If
			If CurrentPage > 1 Then
				If (CurrentPage - 1) * MaxPerPage < totalPut Then
					rsLabel.Move (CurrentPage - 1) * MaxPerPage
				Else
					CurrentPage = 1
				End If
			End If
			Do While Not rsLabel.Eof
				If i=0 Then
					data = data & "{""id"":"&rsLabel("LabelID")&",""LabelName"":""{$"&ToUnicode(rsLabel("LabelName"))&"}"",""LabelClass"":"""&rsLabel("LabelClass")&""",""LabelType"":"""&rsLabel("LabelType")&""",""sort"":"""&rsLabel("Priority")&""",""LabelIntro"":"""&WK_HTMLEncode(rsLabel("LabelIntro"))&"""}"
				Else
					data = data & ",{""id"":"&rsLabel("LabelID")&",""LabelName"":""{$"&ToUnicode(rsLabel("LabelName"))&"}"",""LabelClass"":"""&rsLabel("LabelClass")&""",""LabelType"":"""&rsLabel("LabelType")&""",""sort"":"""&rsLabel("Priority")&""",""LabelIntro"":"""&WK_HTMLEncode(rsLabel("LabelIntro"))&"""}"
				End If
				iCount = iCount + 1
				If iCount >= MaxPerPage Then Exit Do
				rsLabel.MoveNext
				i=i+1
			Loop
			rsLabel.Close
		End If
		If totalPut = 0 Then
			Response.Write "{""code"":201,""msg"":""\u65e0\u6570\u636e""}" & vbCrLf
		Else
			Response.Write "{""code"":0,""msg"":""\u83b7\u53d6\u6210\u529f!"",""count"":"&totalPut&",""data"":["&data&"],""rel"":1}" & vbCrLf
		End If
		Response.End()
	Else
		ListType = Code_CLng(Trim(Request("ListType")))
		ClassType = ReplaceBadChar(Trim(Request("ClassType")))
		Response.Write "<!DOCTYPE html>" & vbCrLf
		Response.Write "<head>" & vbCrLf
		Response.Write "<title>标签管理</title>" & vbCrlf
		Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
		Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
		Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
		Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
		Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
		Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
		Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
		Response.Write "<script type='text/javascript'>" & vbCrLf
		Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
		Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
		Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
		Response.Write "</head>" & vbCrlf
		Response.Write "<body>" & vbCrlf
		Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrLf
		Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrLf
		Response.Write "        <legend>标签列表</legend>" & vbCrLf
		Response.Write "    </fieldset>" & vbCrLf
		Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrLf
		Response.Write "        <a href=""?Action=AddStat"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加静态标签</a>" & vbCrLf
		Response.Write "        <a href=""?Action=AddDyna"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加动态标签</a>" & vbCrLf
		Response.Write "        <a href=""?Action=AddDyna&AddType=2"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加函数标签</a>" & vbCrLf
		Response.Write "        <a href=""?Action=Main"" class=""layui-btn layui-btn-sm"
		If ListType=0 Then Response.Write " layui-btn-danger"
		Response.Write """>" & vbCrlf
		Response.Write "            <i class=""fa fa-file-code-o""></i> 静态标签" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "        <a href=""?Action=Main&ListType=1"" class=""layui-btn layui-btn-sm"
		If ListType=1 Then Response.Write " layui-btn-danger"
		Response.Write """>" & vbCrlf
		Response.Write "            <i class=""fa fa-file-code-o""></i> 动态标签" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "        <a href=""?Action=Main&ListType=2"" class=""layui-btn layui-btn-sm"
		If ListType=2 Then Response.Write " layui-btn-danger"
		Response.Write """>" & vbCrlf
		Response.Write "            <i class=""fa fa-file-code-o""></i> 函数标签" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "    </blockquote>" & vbCrLf
		Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrLf
		Response.Write "        <a href=""?Action=Main&ListType=" & ListType & """ class=""layui-btn layui-btn-sm"
		If ClassType="" Then Response.Write " layui-btn-danger"
		Response.Write """>" & vbCrlf
		Response.Write "            <i class=""fa fa-file-code-o""></i> 全部分类" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Call Exec(rsLabelClass,"select LabelClass from Label Where LabelType=" & ListType & " GROUP BY LabelClass",2)
		Do While Not rsLabelClass.EOF
			If Trim(rsLabelClass(0) & "") <> "" Then
				Response.Write "        <a href=""?Action=Main&ListType=" & ListType & "&ClassType=" & rsLabelClass(0) & """ class=""layui-btn layui-btn-sm"
				If ClassType <> "" And ClassType = rsLabelClass(0) Then Response.Write " layui-btn-danger"
				Response.Write """>" & vbCrlf
				Response.Write "            <i class=""fa fa-file-code-o""></i> " & rsLabelClass(0) & "" & vbCrlf
				Response.Write "        </a>" & vbCrlf
			End If
			rsLabelClass.MoveNext
		Loop
		Set rsLabelClass = Nothing
		Response.Write "    </blockquote>" & vbCrLf
		Response.Write "    <table class=""layui-table"" id=""list"" lay-filter=""list""></table>" & vbCrLf
		Response.Write "</div>" & vbCrLf
		Response.Write "<script type=""text/html"" id=""LabelType"">" & vbCrLf
		Response.Write "    {{# if(d.LabelType==2){ }}" & vbCrLf
		Response.Write "    函数标签" & vbCrLf
		Response.Write "    {{# }else if(d.LabelType==1){  }}" & vbCrLf
		Response.Write "    动态标签" & vbCrLf
		Response.Write "    {{# }else{  }}" & vbCrLf
		Response.Write "    静态标签" & vbCrLf
		Response.Write "    {{# } }}" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type=""text/html"" id=""action"">" & vbCrLf
		Response.Write "    <a href=""?Action=Modify&LabelID={{d.id}}"" class=""layui-btn layui-btn-xs"">编辑</a>" & vbCrLf
		Response.Write "    <a class=""layui-btn layui-btn-xs layui-btn-danger"" lay-event=""del"">删除</a>" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type=""text/html"" id=""order"">" & vbCrLf
		Response.Write "    <input name=""{{d.id}}"" data-id=""{{d.id}}"" class=""list_order layui-input"" value=""{{d.sort}}"" size=""10""/>" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script>" & vbCrLf
		Response.Write "    layui.use('table', function() {" & vbCrLf
		Response.Write "        var table = layui.table, $ = layui.jquery;" & vbCrLf
		Response.Write "        var tableIn=table.render({" & vbCrLf
		Response.Write "            elem: '#list'," & vbCrLf
		Response.Write "            url: '?Action=Main'," & vbCrLf
		Response.Write "            method: 'post'," & vbCrLf
		Response.Write "            where: {//设定异步数据接口的参数" & vbCrLf
		Response.Write "                ListType: '"&ListType&"',ClassType: '"&ClassType&"'" & vbCrLf
		Response.Write "            }," & vbCrLf
		Response.Write "            cellMinWidth: 80," & vbCrLf
		Response.Write "            page:true," & vbCrLf
		Response.Write "            cols: [[" & vbCrLf
		'Response.Write "                {field: 'id', title: '编号', width:80, fixed: true}," & vbCrLf
		Response.Write "                {field: 'LabelName', title: '标签名称', width: 120,fixed: true}," & vbCrLf
		Response.Write "                {field: 'LabelClass', title: '标签分类', width: 100}," & vbCrLf
		Response.Write "                {field: 'LabelType', title: '标签类型', width: 100,templet: '#LabelType'}," & vbCrLf
		If ListType = 0 Then Response.Write "                {field: 'LabelIntro', title: '标签简介', width: 200}," & vbCrLf
		If ListType = 1 Or ListType = 2 Then Response.Write "                {field: 'LabelIntro', title: '查询语句', width: 200}," & vbCrLf
		Response.Write "                {field: 'sort', title: '优先级', width: 100, sort: true,templet: '#order'}," & vbCrLf
		Response.Write "                {title: '操作', width: 190, align: 'center', toolbar: '#action'}" & vbCrLf
		Response.Write "            ]]" & vbCrLf
		Response.Write "        });" & vbCrLf
		Response.Write "        table.on('tool(list)', function(obj) {" & vbCrLf
		Response.Write "            var data = obj.data;" & vbCrLf
		Response.Write "            if(obj.event === 'del'){" & vbCrLf
		Response.Write "                    layer.confirm('你确定要删除该标签吗？', function(index){" & vbCrLf
		Response.Write "                    $.ajax({" & vbCrLf
		Response.Write "                        type: 'post'," & vbCrLf
		Response.Write "                        url: '?Action=Del'," & vbCrLf
		Response.Write "                        data: {id:data.id}," & vbCrLf
		Response.Write "                        dataType: 'json'," & vbCrLf
		Response.Write "                        success: function(res) {" & vbCrLf
		Response.Write "                            if (res.code == 1) {" & vbCrLf
		Response.Write "                                layer.msg(res.msg,{time:1000,icon:1});" & vbCrLf
		Response.Write "                                obj.del();" & vbCrLf
		Response.Write "                            }else{" & vbCrLf
		Response.Write "                                layer.msg(res.msg,{time:1000,icon:2});" & vbCrLf
		Response.Write "                            }" & vbCrLf
		Response.Write "                        }" & vbCrLf
		Response.Write "                    });" & vbCrLf
		Response.Write "                    layer.close(index);" & vbCrLf
		Response.Write "                });" & vbCrLf
		Response.Write "            }" & vbCrLf
		Response.Write "        });" & vbCrLf
		Response.Write "        $('body').on('blur','.list_order',function() {" & vbCrLf
		Response.Write "            var id = $(this).attr('data-id');" & vbCrLf
		Response.Write "            var sort = $(this).val();" & vbCrLf
		Response.Write "            var loading = layer.load(1, {shade: [0.1, '#fff']});" & vbCrLf
		Response.Write "            $.ajax({" & vbCrLf
		Response.Write "                type: 'post'," & vbCrLf
		Response.Write "                url: '?Action=ListOrder'," & vbCrLf
		Response.Write "                data: {id:id,sort:sort,ListType:"""&ListType&""",ClassType:"""&ClassType&"""}," & vbCrLf
		Response.Write "                dataType: 'json'," & vbCrLf
		Response.Write "                success: function(res) {" & vbCrLf
		Response.Write "                    layer.close(loading);" & vbCrLf
		Response.Write "                    if (res.code == 1) {" & vbCrLf
		Response.Write "                        layer.msg(res.msg,{time:1000,icon:1});" & vbCrLf
		Response.Write "                        tableIn.reload();" & vbCrLf
		Response.Write "                    }else{" & vbCrLf
		Response.Write "                        layer.msg(res.msg,{time:1000,icon:2});" & vbCrLf
		Response.Write "                    }" & vbCrLf
		Response.Write "                }" & vbCrLf
		Response.Write "            });" & vbCrLf
		Response.Write "        })" & vbCrLf
		Response.Write "    });" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "</body>" & vbCrLf & "</html>"
	End If
End Sub

Sub ShowJSLabel(LabelType)
    Dim TrueSiteUrl
    TrueSiteUrl = Trim(Request.ServerVariables("HTTP_HOST"))
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function addclass(){" & vbCrLf
    Response.Write "    var select=document.myform.LabelClassList;" & vbCrLf
    Response.Write "    for(i=0;i<select.length;i++){" & vbCrLf
    Response.Write "        if(document.myform.LabelClassList[i].selected==true){" & vbCrLf
    Response.Write "            document.myform.LabelClass.value=document.myform.LabelClassList[i].value;" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckForm(){" & vbCrLf
    Response.Write "  if (document.myform.LabelName.value==''){" & vbCrLf
    Response.Write "     IsAlertFocus(""标签名称不能为空！"",""LabelName"");" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.LabelIntro.value==''){" & vbCrLf
    If LabelType = 0 Then
        Response.Write "     IsAlertFocus(""标签简介不能为空！"",""LabelIntro"");" & vbCrLf
    ElseIf LabelType = 1 Or LabelType = 2 Then
        Response.Write "     IsAlertFocus(""查询语句不能为空！"",""LabelIntro"");" & vbCrLf
    Else
        Response.Write "     IsAlertFocus(""连接地址不能为空！"",""LabelIntro"");" & vbCrLf
    End If
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Priority.value==''){" & vbCrLf
    Response.Write "     IsAlertFocus(""优先等级不能为空！"",""Priority"");" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf

    Response.Write "  if (!LabelContent.getValue()){" & vbCrLf
    Response.Write "     Dialog.alert(""标签内容不能为空！"", function() {LabelContent.focus();});" & vbCrlf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  return true;" & vbCrlf
    Response.Write "}" & vbCrLf

    If (LabelType = 1 Or LabelType = 2) And (Action = "AddDyna2" Or Action = "Modify") Then
        Response.Write "function addfield(fieldname,num,dbname,dbtype,Content){" & vbCrLf
		Response.Write "    AddLabel('Test','标签属性设置','" & InstallDir & AdminFolder & "/Admin/Admin_Pfield.asp?fieldname=' + fieldname + '&num='+ num + '&dbname=' + dbname +'&dbtype=' + dbtype +'&type=' + Content,450,300,Content)" & vbCrLf
        Response.Write "}" & vbCrLf
        Response.Write "function addfield2(fiele1){" & vbCrLf
        Response.Write "    if (fiele1 != null){" & vbCrLf
        Response.Write "        CssInsertCode(""{input("" + fiele1 + "")}"",""LabelContent"");" & vbCrLf
        Response.Write "    }" & vbCrLf
        Response.Write "}" & vbCrLf
    End If
    Response.Write "</script>" & vbCrLf
End Sub

Sub Add()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>标签管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link rel='stylesheet' type='text/css' href='../Js/Codemirror/Codemirror.css'/>" & vbCrLf
	Response.Write "<link rel='stylesheet' type='text/css' href='../Plugins/editor/css/editormd.min.css'/>" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/Codemirror.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/xml.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/css.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/javascript.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/htmlmixed.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/mirrorframe.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/editor/editormd.min.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
    Call ShowJSLabel(0)
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrLf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrLf
	Response.Write "        <legend>标签列表</legend>" & vbCrLf
	Response.Write "    </fieldset>" & vbCrLf
	Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrLf
	Response.Write "        <a href=""?Action=AddStat"" class=""layui-btn layui-btn-sm layui-btn-danger""><i class=""fa fa-plus""></i> 添加静态标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=AddDyna"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加动态标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=AddDyna&AddType=2"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加函数标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=Main"" class=""layui-btn layui-btn-sm"
	If ListType=0 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 静态标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "        <a href=""?Action=Main&ListType=1"" class=""layui-btn layui-btn-sm"
	If ListType=1 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 动态标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "        <a href=""?Action=Main&ListType=2"" class=""layui-btn layui-btn-sm"
	If ListType=2 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 函数标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "    </blockquote>" & vbCrLf
	Response.Write "    <br>" & vbCrLf
    Response.Write "<form action='" & strFileName & "' method='post' name='myform' id='myform' onSubmit='return CheckForm();'>"
    Response.Write "<div class=""table-responsive"">" & vbCrLf
	Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "    <tr class='title' height='30'>"
    Response.Write "      <td align='center'><strong>添 加 静 态 标 签</strong></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签名称：</strong></td>"
    Response.Write "          <td>{$WK_<input name='LabelName' type='text' id='LabelName' size='30' maxlength='50'>}</td>"
    Response.Write "          <td width='10'></td>"
    Response.Write "          <td><font color='#FF0000'>* 输入名称（英文要注意大小写）即可，不用输入定界符。</font></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签分类：</strong></td>"
    Response.Write "          <td colspan='3'><input name='LabelClass' type='text' id='LabelClass' size='30' maxlength='50'> " & getlabelclass(0) & "</td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "         <tr><td width='100' align='center'><strong>标签简介：</strong></td>"
    Response.Write "         <td><textarea name='LabelIntro' cols='96' rows='4' id='LabelIntro' style='width:620px;'></textarea></td></tr>"
    Response.Write "  </table></tr>" & vbCrLf
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>优 先 级：</strong></td>"
    Response.Write "          <td><input name='Priority' type='text' id='Priority' size='5' maxlength='5'></td>"
    Response.Write "          <td width='10'></td>"
    Response.Write "          <td><font color='#FF0000'>数字越小，优先级越高。当标签中再嵌套调用其他标签时，就需要决定标签的优先级。<br>系统按照如下顺序来替换标签：自定义标签-->系统通用标签-->模型标签</font></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "     <td>"
    Response.Write "       <table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签内容：</strong></td>"
    Response.Write "          <td><div id=""editormd""></div><textarea id='LabelContent' name='LabelContent' style=""display:none;""></textarea></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "LabelContent = editormd(""editormd"", {" & vbCrLf
	Response.Write "	width : ""100%""," & vbCrLf
	Response.Write "	height : ""300px""," & vbCrLf
	Response.Write "	watch : false," & vbCrLf
	Response.Write "	toolbar : false," & vbCrLf
	Response.Write "	codeFold : true," & vbCrLf
	Response.Write "	searchReplace : true," & vbCrLf
	Response.Write "	placeholder : ""请输入html代码""," & vbCrLf
	Response.Write "	value : document.getElementById(""LabelContent"").value," & vbCrLf
	Response.Write "	theme : ""default""," & vbCrLf
	Response.Write "	mode : ""text/html""," & vbCrLf
	Response.Write "	path : '../Plugins/editor/lib/'" & vbCrLf
	Response.Write "});" & vbCrLf
	Response.Write "</script>" & vbCrLf
    Response.Write "     </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td height='40'  align='center'>"
    Response.Write "        <input name='LabelType' type='hidden' id='LabelType' value='0'>"
    Response.Write "        <input name='Scode' type='hidden' id='Scode' value='" & CheckSecretCode("start") & "'>"
    Response.Write "        <input name='Action' type='hidden' id='Action' value='SaveAdd'>"
    Response.Write Submit_Init(" 添 加 ","重新填写","确认要清空对话框内容？","javascript:history.back();","返回上一页")
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
	Response.Write "</div>" & vbCrLf
    Response.Write "</form>"
	Response.Write "</div>" & vbCrLf
	Response.Write "<script>" & vbCrLf
	Response.Write "    layui.use('table', function() {" & vbCrLf
	Response.Write "        var table = layui.table;" & vbCrLf
	Response.Write "    })" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub AddDyna()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>标签管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link rel='stylesheet' type='text/css' href='../Js/Codemirror/Codemirror.css'/>" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/Codemirror.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/xml.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/css.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/javascript.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/htmlmixed.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/mirrorframe.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
    Dim LabelName1, lnum, AddType, dbname1, dbname2, i, rs, sqlstr, rstSchema
    LabelName1 = Trim(Request("LabelName1"))
    lnum = Code_CLng(Trim(Request("lnum")))
    AddType = Code_CLng(Trim(Request("AddType")))
    If AddType <> 2 Then AddType = 1
    dbname1 = Trim(Request("dbname1"))
    If dbname1 <> "" Then
        dbname1 = ReplaceBadChar(dbname1)
    End If
    dbname2 = ReplaceBadChar(Trim(Request("dbname2")))
    If dbname2 <> "" Then
        dbname2 = ReplaceBadChar(dbname2)
    End If

    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function addclass(){" & vbCrLf
    Response.Write "    var select=document.myform.LabelClassList;" & vbCrLf
    Response.Write "    for(i=0;i<select.length;i++){" & vbCrLf
    Response.Write "        if(document.myform.LabelClassList[i].selected==true){" & vbCrLf
    Response.Write "            document.myform.LabelClass.value=document.myform.LabelClassList[i].value;" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckForm(){" & vbCrLf
    Response.Write "  if (document.myform.LabelName.value==''){" & vbCrLf
    Response.Write "     IsAlertFocus(""标签名称不能为空！"",""LabelName"");" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.LabelIntro.value==''){" & vbCrLf
    Response.Write "     IsAlertFocus(""查询语句不能为空！"",""LabelIntro"");" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Priority.value==''){" & vbCrLf
    Response.Write "     IsAlertFocus(""优 先 等级不能为空！"",""Priority"");" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  return true;" & vbCrlf
    Response.Write "}" & vbCrLf
    Response.Write "function changedb(){" & vbCrLf
    Response.Write "    var dbname=document.myform.dbname1.value;" & vbCrLf
    Response.Write "    var dbname2=document.myform.dbname2.value;" & vbCrLf
    Response.Write "    var Labelname=document.myform.LabelName.value;" & vbCrLf
    Response.Write "    var Listnum=document.myform.pagenum.value;" & vbCrLf
    Response.Write "    var AddType=document.myform.labeltype;" & vbCrLf
    Response.Write "    for(i=0;i<AddType.length;i++){" & vbCrLf
    Response.Write "        if(document.myform.labeltype[i].checked==true){" & vbCrLf
    Response.Write "            var AddType2=document.myform.labeltype[i].value" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    window.location.href=""" & strFileName & "?Action=AddDyna&lnum="" + Listnum + ""&AddType="" + AddType2 + ""&dbname1="" + dbname + ""&dbname2="" + dbname2 + ""&LabelName1="" + Labelname + """";" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function addfield(){" & vbCrLf
    Response.Write "    document.myform.LabelIntro.value='';" & vbCrLf
    Response.Write "    var select=document.myform.field;" & vbCrLf
    Response.Write "    var select2=document.myform.field2;" & vbCrLf
    Response.Write "    for(i=0;i<select.length;i++){" & vbCrLf
    Response.Write "        if(document.myform.field[i].selected==true){" & vbCrLf
    Response.Write "            if(document.myform.dbname2.value==''){" & vbCrLf
    Response.Write "                if (document.myform.LabelIntro.value==''){" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=document.myform.field[i].value;" & vbCrLf
    Response.Write "                }else{" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=document.myform.LabelIntro.value+"",""+document.myform.field[i].value;" & vbCrLf
    Response.Write "                }" & vbCrLf
    Response.Write "            }else{" & vbCrLf
    Response.Write "                if (document.myform.LabelIntro.value==''){" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=document.myform.dbname1.value + ""."" + document.myform.field[i].value;" & vbCrLf
    Response.Write "                }else{" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=document.myform.LabelIntro.value + "","" + document.myform.dbname1.value + ""."" + document.myform.field[i].value;" & vbCrLf
    Response.Write "                }" & vbCrLf
    Response.Write "            }" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if(document.myform.dbname2.value==''){" & vbCrLf
    Response.Write "        if(document.myform.pagenum.value>0){" & vbCrLf
    Response.Write "            document.myform.LabelIntro.value=""select "" + document.myform.LabelIntro.value + "" from " & dbname1 & """;" & vbCrLf
    Response.Write "        }else{" & vbCrLf
    Response.Write "            document.myform.LabelIntro.value=""select top 10 "" + document.myform.LabelIntro.value + "" from " & dbname1 & """;" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }else{" & vbCrLf
    Response.Write "        for(i=0;i<select2.length;i++){" & vbCrLf
    Response.Write "            if(document.myform.field2[i].selected==true){" & vbCrLf
    Response.Write "                if (document.myform.LabelIntro.value==''){" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=document.myform.dbname2.value + ""."" + document.myform.field2[i].value;" & vbCrLf
    Response.Write "                }else{" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=document.myform.LabelIntro.value + "","" + document.myform.dbname2.value + ""."" + document.myform.field2[i].value;" & vbCrLf
    Response.Write "                }" & vbCrLf
    Response.Write "            }" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "        if(document.myform.dbname1.value==''){" & vbCrLf
    Response.Write "            if(document.myform.pagenum.value>0){" & vbCrLf
    Response.Write "                document.myform.LabelIntro.value=""select "" + document.myform.LabelIntro.value + "" from " & dbname2 & """;" & vbCrLf
    Response.Write "            }else{" & vbCrLf
    Response.Write "                document.myform.LabelIntro.value=""select top 10 "" + document.myform.LabelIntro.value + "" from " & dbname2 & """;" & vbCrLf
    Response.Write "            }" & vbCrLf
    Response.Write "        }else{" & vbCrLf
    Response.Write "            if(document.myform.bg1.value==''){" & vbCrLf
    Response.Write "                if(document.myform.pagenum.value>0){" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=""select "" + document.myform.LabelIntro.value + "" from " & dbname1 & "," & dbname2 & """;" & vbCrLf
    Response.Write "                }else{" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=""select top 10 "" + document.myform.LabelIntro.value + "" from " & dbname1 & "," & dbname2 & """;" & vbCrLf
    Response.Write "                }" & vbCrLf
    Response.Write "            }else{" & vbCrLf
    Response.Write "                if(document.myform.pagenum.value>0){" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=""select "" + document.myform.LabelIntro.value + "" from " & dbname1 & "," & dbname2 & " where "";" & vbCrLf
    Response.Write "                }else{" & vbCrLf
    Response.Write "                    document.myform.LabelIntro.value=""select top 10 "" + document.myform.LabelIntro.value + "" from " & dbname1 & "," & dbname2 & " where "";" & vbCrLf
    Response.Write "                }" & vbCrLf
    Response.Write "                document.myform.LabelIntro.value=document.myform.LabelIntro.value + """ & dbname1 & "."" + document.myform.bg1.value + "" = "" + """ & dbname2 & "."" + document.myform.bg2.value;" & vbCrLf
    Response.Write "            }" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function checkfield(){" & vbCrLf
    Response.Write "    var strtmpp = ""<table class='layui-table table-hover'><tr align='center'>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist2(0)'>{$Now}</td>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist2(1)'>{$NowDay}</td>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist2(2)'>{$NowMonth}</td>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist2(3)'>{$NowYear}</td></tr><tr align='center'>"";" & vbCrLf
    Response.Write "    var fieldtemp = document.myform.FieldList.value.split(""\n"");" & vbCrLf
    Response.Write "        for(i=0;i<fieldtemp.length;i++){" & vbCrLf
    Response.Write "            strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist("" + i + "")'>"" + fieldtemp[i] + ""</td>"";" & vbCrLf
    Response.Write "            if(((i+1)%6) == 0){" & vbCrLf
    Response.Write "                strtmpp = strtmpp + ""</tr><tr align='center'>"";" & vbCrLf
    Response.Write "            }" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "        strtmpp = strtmpp + ""</table>"";" & vbCrLf
    Response.Write "        document.getElementById (""flist2"").innerHTML=strtmpp;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function addlist(input){" & vbCrLf
    Response.Write "    if (input != null){" & vbCrLf
    Response.Write "        CssInsertCode(""{input("" + input + "")}"",""LabelIntro"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
	Response.Write "function CssInsertCode(Val,Content) {" & vbCrLf
	Response.Write "if (document.selection) {" & vbCrLf
	Response.Write "document.getElementById(Content).focus();" & vbCrLf
	Response.Write "var sel = document.selection.createRange();" & vbCrLf
	Response.Write "sel.text = Val;" & vbCrLf
	Response.Write "} else if (typeof document.getElementById(Content).selectionStart === 'number' && typeof document.getElementById(Content).selectionEnd === 'number') {" & vbCrLf
	Response.Write "var startPos = document.getElementById(Content).selectionStart,endPos = document.getElementById(Content).selectionEnd,cursorPos = startPos,tmpStr = document.getElementById(Content).value;" & vbCrLf
	Response.Write "document.getElementById(Content).value = tmpStr.substring(0, startPos) + Val + tmpStr.substring(endPos, tmpStr.length);" & vbCrLf
	Response.Write "cursorPos += Val.length;" & vbCrLf
	Response.Write "document.getElementById(Content).selectionStart = document.getElementById(Content).selectionEnd = cursorPos;" & vbCrLf
	Response.Write "} else {" & vbCrLf
	Response.Write "document.getElementById(Content).value += Val;" & vbCrLf
	Response.Write "}" & vbCrLf
	Response.Write "}" & vbCrLf
    Response.Write "function addlist2(input){" & vbCrLf
    Response.Write "    if (input == 0){" & vbCrLf
    Response.Write "        CssInsertCode(""{$Now}"",""LabelIntro"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if (input == 1){" & vbCrLf
    Response.Write "        CssInsertCode(""{$NowDay}"",""LabelIntro"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if (input == 2){" & vbCrLf
    Response.Write "        CssInsertCode(""{$NowMonth}"",""LabelIntro"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if (input == 3){" & vbCrLf
    Response.Write "        CssInsertCode(""{$NowYear}"",""LabelIntro"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrLf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrLf
	Response.Write "        <legend>标签列表</legend>" & vbCrLf
	Response.Write "    </fieldset>" & vbCrLf
	Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrLf
	Response.Write "        <a href=""?Action=AddStat"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加静态标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=AddDyna"" class=""layui-btn layui-btn-sm"
	If Action="AddDyna" And AddType<>2 Then Response.Write " layui-btn-danger"
	Response.Write """><i class=""fa fa-plus""></i> 添加动态标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=AddDyna&AddType=2"" class=""layui-btn layui-btn-sm"
	If Action="AddDyna" And AddType=2 Then Response.Write " layui-btn-danger"
	Response.Write """><i class=""fa fa-plus""></i> 添加函数标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=Main"" class=""layui-btn layui-btn-sm"
	If ListType=0 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 静态标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "        <a href=""?Action=Main&ListType=1"" class=""layui-btn layui-btn-sm"
	If ListType=1 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 动态标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "        <a href=""?Action=Main&ListType=2"" class=""layui-btn layui-btn-sm"
	If ListType=2 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 函数标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "    </blockquote>" & vbCrLf
	Response.Write "    <br>" & vbCrLf
    Response.Write "<form action='" & strFileName & "' method='post' name='myform' id='myform' onSubmit='return CheckForm();'>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "    <tr class='title' height='30'>"
    Response.Write "      <td align='center'><strong>添 加 动 态 标 签（第一步）</strong></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签名称：</strong></td>"
    Response.Write "          <td width='280'>{$WK_<input name='LabelName' type='text' id='LabelName' size='30' maxlength='50' value=" & LabelName1 & ">}</td>"
    Response.Write "          <td width='10'></td>"
    Response.Write "          <td><font color='#FF0000'>* 输入名称（英文要注意大小写）即可，不用输入定界符。</font></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签分类：</strong></td>"
    Response.Write "          <td colspan='3'><input name='LabelClass' type='text' id='LabelClass' size='30' maxlength='50'> " & getlabelclass(AddType) & "</td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签类型：</strong></td>"
    Response.Write "          <td><Input type='radio' name='labeltype' value=1"
    If AddType = 1 Then Response.Write " checked"
    Response.Write " onClick=""flist.style.display='none';"">标准动态标签 <Input type='radio' name='labeltype' value=2"
    If AddType = 2 Then Response.Write " checked"
    Response.Write " onClick=""flist.style.display='';"">函数型动态标签</td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>分页数量：</strong></td>"
    Response.Write "          <td width='45'><input name='pagenum' type='text' id='pagenum' size='3' maxlength='10' value=" & lnum & "></td>"
    Response.Write "          <td width='10'></td><td><font color='#FF0000'>* 动态标签分页显示的每页显示数,为0时则不分页。</font></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>自动刷新：</strong></td>"
    Response.Write "          <td width='45'><input name='rtime' type='text' id='rtime' size='3' maxlength='3' value=0></td>"
    Response.Write "          <td width='10'></td><td><font color='#FF0000'>* 标签内容自动刷新频率，必须大于10秒并启用分页功能才能启动。</font></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "      <td width='100' align='center'><strong>主表：</strong></td>"
    Response.Write "      <td><div id=""dbname1_outer"" ztype=""select"" class=""z-combox"" style=""display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;height:auto;width:auto;position:relative;border:none 0;margin:0;padding:0;white-space: nowrap;"" _style=""width:100%;""><input type=""text"" ztype=""select"" id=""dbname1"" name=""dbname1"" tabindex=""-1"" autocomplete=""off"" class=""inputText"" style=""width:100%;position:absolute;z-index:-1;"" onchange=""changedb()"" value=""" & dbname1 & """ startvalue=""" & dbname1 & """/><input type=""text"" id=""dbname1_textField"" autocomplete=""off"" class=""inputText"" style=""vertical-align:middle; cursor:default;width:100%;"" /><a id=""dbname1_spinner"" class=""z-combox-spinner"" style=""position:relative; left:-17px; margin-right:-15px; cursor:pointer; width:13px; height:15px;vertical-align:middle;""><b></b></a><div id=""dbname1_list"" class=""optgroup"" style=""text-align:left;display:none;""><div id=""dbname1_ul"" style=""left:-1px; width:-1px;""><script>Combox_dbname1_Init=function(){var _el=Zving.getDom('dbname1');if(_el._components){return true;}var  _data=[];var  _DataSource;"
    Response.Write "_data.push(['','请选择一个表']);"
    Set rstSchema = Conn.OpenSchema(20)
    Do Until rstSchema.EOF
    If Left(rstSchema("TABLE_NAME"), 2) <> "MS" And rstSchema("TABLE_NAME") <> "" And rstSchema("TABLE_NAME") <> "Admin" And rstSchema("TABLE_NAME") <> "Config" Then
        Response.Write "_data.push(['" & rstSchema("TABLE_NAME") & "','" & rstSchema("TABLE_NAME") & "']);"
    End If
    rstSchema.MoveNext
    Loop
    Response.Write "var combox_dbname1 = new Zving.Selector({el:_el,data:_data,DataSource:_DataSource});};if(Zving.Page.isReady){Combox_dbname1_Init();}else{Zving.Page.onReady(Combox_dbname1_Init);}</script></div></div></div></td>"
    Response.Write "      <td width='100' align='center'><strong>从表：</strong></td>"
    Response.Write "      <td><div id=""dbname2_outer"" ztype=""select"" class=""z-combox"" style=""display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;height:auto;width:auto;position:relative;border:none 0;margin:0;padding:0;white-space: nowrap;"" _style=""width:100%;""><input type=""text"" ztype=""select"" id=""dbname2"" name=""dbname2"" tabindex=""-1"" autocomplete=""off"" class=""inputText"" style=""width:100%;position:absolute;z-index:-1;"" onchange=""changedb()"" value=""" & dbname2 & """ startvalue=""" & dbname2 & """/><input type=""text"" id=""dbname2_textField"" autocomplete=""off"" class=""inputText"" style=""vertical-align:middle; cursor:default;width:100%;"" /><a id=""dbname2_spinner"" class=""z-combox-spinner"" style=""position:relative; left:-17px; margin-right:-15px; cursor:pointer; width:13px; height:15px;vertical-align:middle;""><b></b></a><div id=""dbname2_list"" class=""optgroup"" style=""text-align:left;display:none;""><div id=""dbname2_ul"" style=""left:-1px; width:-1px;""><script>Combox_dbname2_Init=function(){var _el=Zving.getDom('dbname2');if(_el._components){return true;}var  _data=[];var  _DataSource;"
    Response.Write "_data.push(['','请选择一个表']);"
    Set rstSchema = Conn.OpenSchema(20)
    Do Until rstSchema.EOF
    If Left(rstSchema("TABLE_NAME"), 2) <> "MS" And rstSchema("TABLE_NAME") <> "" And rstSchema("TABLE_NAME") <> "Admin" And rstSchema("TABLE_NAME") <> "Config" Then
        Response.Write "_data.push(['" & rstSchema("TABLE_NAME") & "','" & rstSchema("TABLE_NAME") & "']);"
    End If
    rstSchema.MoveNext
    Loop
    Response.Write "var combox_dbname2 = new Zving.Selector({el:_el,data:_data,DataSource:_DataSource});};if(Zving.Page.isReady){Combox_dbname2_Init();}else{Zving.Page.onReady(Combox_dbname2_Init);}</script></div></div></div></td></tr>"
    If dbname1 <> "" And dbname2 <> "" Then
        Response.Write "        <tr><td align='center'><strong>约束标签：</strong></td>"
        Response.Write "          <td><div id=""bg1_outer"" ztype=""select"" class=""z-combox"" style=""display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;height:auto;width:auto;position:relative;border:none 0;margin:0;padding:0;white-space: nowrap;"" _style=""width:100%;""><input type=""text"" ztype=""select"" id=""bg1"" name=""bg1"" tabindex=""-1"" autocomplete=""off"" class=""inputText"" style=""width:100%;position:absolute;z-index:-1;"" value="""" startvalue=""""/><input type=""text"" id=""bg1_textField"" autocomplete=""off"" class=""inputText"" style=""vertical-align:middle; cursor:default;width:100%;"" /><a id=""bg1_spinner"" class=""z-combox-spinner"" style=""position:relative; left:-17px; margin-right:-15px; cursor:pointer; width:13px; height:15px;vertical-align:middle;""><b></b></a><div id=""bg1_list"" class=""optgroup"" style=""text-align:left;display:none;""><div id=""bg1_ul"" style=""left:-1px; width:-1px;""><script>Combox_bg1_Init=function(){var _el=Zving.getDom('bg1');if(_el._components){return true;}var  _data=[];var  _DataSource;"
        Response.Write "_data.push(['','选择主表标签']);"
        If dbname1 <> "" Then
            sqlstr = "select * from " & dbname1
		    Call Exec(rs,sqlstr,2)
            For i = 0 To rs.Fields.Count - 1
                Response.Write "_data.push(['" & rs(i).name & "','" & rs(i).name & "']);"
            Next
        Else
            Response.Write "_data.push(['0','请先选择一个表']);"
        End If
        Response.Write "var combox_bg1 = new Zving.Selector({el:_el,data:_data,DataSource:_DataSource});};if(Zving.Page.isReady){Combox_bg1_Init();}else{Zving.Page.onReady(Combox_bg1_Init);}</script></div></div></div></td><td align='center'><strong><< 等于 >></strong></td><td><div id=""bg2_outer"" ztype=""select"" class=""z-combox"" style=""display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;height:auto;width:auto;position:relative;border:none 0;margin:0;padding:0;white-space: nowrap;"" _style=""width:100%;""><input type=""text"" ztype=""select"" id=""bg2"" name=""bg2"" tabindex=""-1"" autocomplete=""off"" class=""inputText"" style=""width:100%;position:absolute;z-index:-1;"" value="""" startvalue=""""/><input type=""text"" id=""bg2_textField"" autocomplete=""off"" class=""inputText"" style=""vertical-align:middle; cursor:default;width:100%;"" /><a id=""bg2_spinner"" class=""z-combox-spinner"" style=""position:relative; left:-17px; margin-right:-15px; cursor:pointer; width:13px; height:15px;vertical-align:middle;""><b></b></a><div id=""bg2_list"" class=""optgroup"" style=""text-align:left;display:none;""><div id=""bg2_ul"" style=""left:-1px; width:-1px;""><script>Combox_bg2_Init=function(){var _el=Zving.getDom('bg2');if(_el._components){return true;}var  _data=[];var  _DataSource;"
        Response.Write "_data.push(['','选择从表标签']);"
        If dbname2 <> "" Then
            sqlstr = "select * from " & dbname2
		    Call Exec(rs,sqlstr,2)
            For i = 0 To rs.Fields.Count - 1
                Response.Write "_data.push(['" & rs(i).name & "','" & rs(i).name & "']);"
            Next
        Else
            Response.Write "_data.push(['0','请先选择一个表']);"
        End If
        Response.Write "         var combox_bg2 = new Zving.Selector({el:_el,data:_data,DataSource:_DataSource});};if(Zving.Page.isReady){Combox_bg2_Init();}else{Zving.Page.onReady(Combox_bg2_Init);}</script></div></div></div></td><td><font color='#FF0000'>请选择跨表查询的约束条件。</font></td>"
        Response.Write "</tr>"
    End If
    Response.Write "        <tr><td width='100' align='center'><strong>选择标签：</strong><br><br><font color='#FF0000'>请选择需要调用的标签名称,按Ctrl或Shift键多选</font></td>"
    Response.Write "         <td width='100'><select name='field' size='1' multiple style='height:200px;width:250px;' onchange='addfield()'>"
    If dbname1 <> "" Then
    sqlstr = "select * from " & dbname1
	Call Exec(rs,sqlstr,2)
    For i = 0 To rs.Fields.Count - 1
        Response.Write "<option value='" & rs(i).name & "'>" & rs(i).name & "</option>"
    Next
    Else
    Response.Write "<option value='0'>请先选择一个表</option>"
    End If
    Response.Write "</select></td>"
    Response.Write "<td align='center'><strong>>>>></strong></td>"
    Response.Write "<td><select name='field2' size='2' multiple style='height:200px;width:250px;' onchange='addfield()'>"
    If dbname2 <> "" Then
    sqlstr = "select * from " & dbname2
	Call Exec(rs,sqlstr,2)
    For i = 0 To rs.Fields.Count - 1
        Response.Write "<option value='" & rs(i).name & "'>" & rs(i).name & "</option>"
    Next
    Else
    Response.Write "<option value='0'>请先选择一个表</option>"
    End If
    Response.Write "</select></td>"
    Response.Write "         <td></td></tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tbody id='flist'"
    If AddType <> 2 Then Response.Write " style=""display:none"""
    Response.Write "><tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>参数说明：</strong></td>"
    Response.Write "          <td width='80'><textarea name='FieldList' cols='40' rows='5' id='FieldList' onkeydown=""checkfield();""></textarea></td>"
    Response.Write "          <td width='10'></td><td><font color='#FF0000'>* 输入函数列表参数,每行一个。</font></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr></tbody>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "         <td width='100' align='center'><strong>查询语句：</strong></td>"
    If lnum > 0 Then
        Response.Write "         <td><div id=""flist2"">"
        Response.Write "<table class='layui-table table-hover'><tr align='center'>"
        Response.Write "<td style='cursor:pointer;' onclick='addlist2(0)'>{$Now}</td>"
        Response.Write "<td style='cursor:pointer;' onclick='addlist2(1)'>{$NowDay}</td>"
        Response.Write "<td style='cursor:pointer;' onclick='addlist2(2)'>{$NowMonth}</td>"
        Response.Write "<td style='cursor:pointer;' onclick='addlist2(3)'>{$NowYear}</td></tr></table>"
        Response.Write "</div><textarea name='LabelIntro' cols='83' rows='6' id='LabelIntro'>select * from " & dbname1 & "</textarea></td>"
    Else
        Response.Write "         <td><div id=""flist2"">"
        Response.Write "<table class='layui-table table-hover'><tr align='center'>"
        Response.Write "<td style='cursor:pointer;' onclick='addlist2(0)'>{$Now}</td>"
        Response.Write "<td style='cursor:pointer;' onclick='addlist2(1)'>{$NowDay}</td>"
        Response.Write "<td style='cursor:pointer;' onclick='addlist2(2)'>{$NowMonth}</td>"
        Response.Write "<td style='cursor:pointer;' onclick='addlist2(3)'>{$NowYear}</td></tr></table>"
        Response.Write "</div><textarea name='LabelIntro' cols='96' rows='6' id='LabelIntro' style='width:600px;'>select top 10 * from " & dbname1 & "</textarea></td>"
    End If
    Response.Write "       </tr></table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>优 先 级：</strong></td>"
    Response.Write "          <td width='50'><input name='Priority' type='text' id='Priority' size='5' maxlength='5'></td>"
    Response.Write "          <td width='10'></td>"
    Response.Write "          <td><font color='#FF0000'>数字越小，优先级越高。当标签中再嵌套调用其他标签时，就需要决定标签的优先级。<br>系统按照如下顺序来替换标签：自定义标签-->系统通用标签-->模型标签</font></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td height='40'  align='center'>"
    Response.Write "        <input name='Action' type='hidden' id='Action' value='AddDyna2'>"
    Response.Write Submit_Init(" 下一步 ","重新填写","确认要清空对话框内容？","javascript:history.back();","返回上一页")
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
    Response.Write "</form>"
    Response.Write "</div>"
	Response.Write "<script>" & vbCrLf
	Response.Write "    layui.use('table', function() {" & vbCrLf
	Response.Write "        var table = layui.table;" & vbCrLf
	Response.Write "    })" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub AddDyna2()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>标签管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link rel='stylesheet' type='text/css' href='../Js/Codemirror/Codemirror.css'/>" & vbCrLf
	Response.Write "<link rel='stylesheet' type='text/css' href='../Plugins/editor/css/editormd.min.css'/>" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/Codemirror.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/xml.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/css.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/javascript.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/htmlmixed.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/mirrorframe.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/editor/editormd.min.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
    Dim LabelName, LabelClass, LabelType, PageNum, RTime, FieldList, LabelIntro, LabelIntro2, Priority, strtmp, dbname1, dbname2, dbtype
    Dim i, rs
    LabelName = "WK_" & Trim(Request.Form("LabelName"))
    LabelClass = Trim(Request.Form("LabelClass"))
    LabelType = Code_CLng(Trim(Request.Form("labeltype")))
    PageNum = Code_CLng(Trim(Request.Form("pagenum")))
    RTime = Code_CLng(Trim(Request.Form("rtime")))
    FieldList = Request.Form("FieldList")
    dbname1 = Trim(Request.Form("dbname1"))
    dbname2 = Trim(Request.Form("dbname2"))
    LabelIntro = Trim(Request.Form("LabelIntro"))
    If Left(LCase(LabelIntro), 6) <> "select" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<br><li>只能做选择查询！</li>"
        Exit Sub
    Else
        If InStr(LCase(LabelIntro), "where") > 0 Then
            regEx.Pattern = "(.*?)\where"
            Set Matches = regEx.Execute(LabelIntro)
            For Each Match In Matches			
                LabelIntro2 = Match.value
                Exit For 
            Next
			
            LabelIntro2 = Trim(Replace(LCase(LabelIntro2), "where", ""))
            regEx.Pattern = "\{input\((.*?)\)\}"
            Set Matches = regEx.Execute(LabelIntro2)
            LabelIntro2 = regEx.Replace(LabelIntro2, "1")
        Else
            regEx.Pattern = "\{input\((.*?)\)\}"
            Set Matches = regEx.Execute(LabelIntro)
            LabelIntro2 = regEx.Replace(LabelIntro, "1")
        End If
    End If
    Priority = Trim(Request.Form("Priority"))

    If dbname1 = "Article" Or dbname2 = "Article" Or InStr(LabelIntro, "Article") > 0 Then
        dbtype = 1
    ElseIf dbname1 = "Photo" Or dbname2 = "Photo" Or InStr(LabelIntro, "Photo") > 0 Then
        dbtype = 2
    ElseIf dbname1 = "Down" Or dbname2 = "Down" Or InStr(LabelIntro, "Down") > 0 Then
        dbtype = 3
    ElseIf dbname1 = "Shop" Or dbname2 = "Shop" Or InStr(LabelIntro, "Shop") > 0 Then
        dbtype = 4
    Else
        dbtype = 0
    End If

    strtmp = "<table class='layui-table table-hover'><tr align='center'>" & vbCrLf
    On Error Resume Next
	Call Exec(rs,LabelIntro2,2)

    If Err.Number <> 0 Then
        Set rs = Nothing
        FoundErr = True
        ErrMsg = ErrMsg & "<li>SQL查询失败，查询代码：" & LabelIntro2 & "错误原因：" & Err.Description
        Err.Clear
        Exit Sub
    Else
        For i = 0 To rs.Fields.Count - 1
            strtmp = strtmp & "<td style=""cursor:pointer;"" onclick=""addfield('" & rs(i).name & "'," & i & "," & dbtype & "," & rs(i).Type & ",'LabelContent')"">" & rs(i).name & "</td>" & vbCrLf
            If (i + 1) Mod 5 = 0 Then
                strtmp = strtmp & "</tr><tr align='center'>"
            End If
        Next
        Set rs = Nothing
    End If
    strtmp = strtmp & "</tr></table>"

    Call ShowJSLabel(1)
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
	Response.Write "function CssInsertCode(Val,Content) {" & vbCrLf
	Response.Write "if(Val != """" && Val != null){" & vbCrlf
	Response.Write "LabelContent.replaceSelection(Val,LabelContent.getCursor());" & vbCrlf
	Response.Write "LabelContent.focus()" & vbCrlf
	Response.Write "}" & vbCrLf
	Response.Write "}" & vbCrLf
    Response.Write "function addlist3(input){" & vbCrLf
    Response.Write "    if (input == 0){" & vbCrLf
    Response.Write "        CssInsertCode(""{$Now}"",""LabelContent"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if (input == 1){" & vbCrLf
    Response.Write "        CssInsertCode(""{$NowDay}"",""LabelContent"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if (input == 2){" & vbCrLf
    Response.Write "        CssInsertCode(""{$NowMonth}"",""LabelContent"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if (input == 3){" & vbCrLf
    Response.Write "        CssInsertCode(""{$NowYear}"",""LabelContent"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if (input == 4){" & vbCrLf
    Response.Write "        CssInsertCode(""{$AutoID}"",""LabelContent"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if (input == 5){" & vbCrLf
    Response.Write "        CssInsertCode(""{$totalPut}"",""LabelContent"");" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrLf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrLf
	Response.Write "        <legend>标签列表</legend>" & vbCrLf
	Response.Write "    </fieldset>" & vbCrLf
	Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrLf
	Response.Write "        <a href=""?Action=AddStat"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加静态标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=AddDyna"" class=""layui-btn layui-btn-sm layui-btn-danger""><i class=""fa fa-plus""></i> 添加动态标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=AddDyna&AddType=2"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加函数标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=Main"" class=""layui-btn layui-btn-sm"
	If ListType=0 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 静态标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "        <a href=""?Action=Main&ListType=1"" class=""layui-btn layui-btn-sm"
	If ListType=1 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 动态标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "        <a href=""?Action=Main&ListType=2"" class=""layui-btn layui-btn-sm"
	If ListType=2 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 函数标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "    </blockquote>" & vbCrLf
	Response.Write "    <br>" & vbCrLf
    Response.Write "<form action='" & strFileName & "' method='post' name='myform' id='myform'>"
    Response.Write "<div class=""table-responsive"">" & vbCrLf
	Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "    <tr class='title' height='30'>"
    If LabelType = 2 Then
        Response.Write "      <td align='center'><strong>添 加 函 数 型 动 态 标 签（第二步）</strong></td>"
    Else
        Response.Write "      <td align='center'><strong>添 加 动 态 标 签（第二步）</strong></td>"
    End If
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签名称：</strong></td>"
    Response.Write "          <td>{$" & LabelName & "}</td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>查询语句：</strong></td>"
    Response.Write "          <td><textarea name='LabelIntro' cols='96' rows='6' id='LabelIntro' style='width:620px;' readonly=""readonly"">" & LabelIntro & "</textarea></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签列表：</strong></td>" & vbCrLf
    Response.Write "          <td>" & strtmp & "</td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"

    strtmp = "<table class='layui-table table-hover'><tr align='center'>" & vbCrLf
    strtmp = strtmp & "<td style='cursor:pointer;' onclick='addlist3(0)'>{$Now}</td>"
    strtmp = strtmp & "<td style='cursor:pointer;' onclick='addlist3(1)'>{$NowDay}</td>"
    strtmp = strtmp & "<td style='cursor:pointer;' onclick='addlist3(2)'>{$NowMonth}</td>"
    strtmp = strtmp & "<td style='cursor:pointer;' onclick='addlist3(3)'>{$NowYear}</td>"
    strtmp = strtmp & "<td style='cursor:pointer;' onclick='addlist3(4)'>{$AutoID}</td>"
    strtmp = strtmp & "<td style='cursor:pointer;' onclick='addlist3(5)'>{$totalPut}</td></tr>"
    If LabelType = 2 And FieldList <> "" Then
        strtmp = strtmp & "<tr align='center'>"
        Dim arrFieldList, FieldList2
        arrFieldList = Split(FieldList, vbCrLf)
        For i = 0 To UBound(arrFieldList)
            If Trim(arrFieldList(i)) <> "" Then
                strtmp = strtmp & "<td style=""cursor:pointer;"" onclick=""addfield2(" & i & ")"">" & arrFieldList(i) & "</td>" & vbCrLf
                If (i + 1) Mod 4 = 0 Then
                    strtmp = strtmp & "</tr><tr align='center'>"
                End If
            End If
            FieldList2 = FieldList2 & arrFieldList(i) & "|||"
        Next
        strtmp = strtmp & "</tr>"
    End If
    strtmp = strtmp & "</table>"

    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>参数列表：</strong></td>" & vbCrLf
    Response.Write "          <td>" & strtmp & "</td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"

    Response.Write "    <tr>"
    Response.Write "     <td>&nbsp;&nbsp;"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签内容：</strong></td>" & vbCrLf
    Response.Write "          <td><div id=""editormd""></div><textarea id='LabelContent' name='LabelContent' style=""display:none;"">{Loop}{Infobegin}循环内容{Infoend}{/Loop}</textarea></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "LabelContent = editormd(""editormd"", {" & vbCrLf
	Response.Write "	width : ""100%""," & vbCrLf
	Response.Write "	height : ""300px""," & vbCrLf
	Response.Write "	watch : false," & vbCrLf
	Response.Write "	toolbar : false," & vbCrLf
	Response.Write "	codeFold : true," & vbCrLf
	Response.Write "	searchReplace : true," & vbCrLf
	Response.Write "	placeholder : ""请输入html代码""," & vbCrLf
	Response.Write "	value : document.getElementById(""LabelContent"").value," & vbCrLf
	Response.Write "	theme : ""default""," & vbCrLf
	Response.Write "	mode : ""text/html""," & vbCrLf
	Response.Write "	path : '../Plugins/editor/lib/'" & vbCrLf
	Response.Write "});" & vbCrLf
	Response.Write "</script>" & vbCrLf
    Response.Write "     </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td height='40'  align='center'>"
    Response.Write "        <input name='LabelName' type='hidden' id='LabelName' value='" & LabelName & "'>"
    Response.Write "        <input name='LabelClass' type='hidden' id='LabelClass' value='" & LabelClass & "'>"
    Response.Write "        <input name='Priority' type='hidden' id='Priority' value=" & Priority & ">"
    Response.Write "        <input name='LabelType' type='hidden' id='LabelType' value=" & LabelType & ">"
    Response.Write "        <input name='pagenum' type='hidden' id='pagenum' value=" & PageNum & ">"
    Response.Write "        <input name='rtime' type='hidden' id='rtime' value=" & RTime & ">"
    Response.Write "        <input name='FieldList' type='hidden' id='FieldList' value=" & FieldList2 & ">"
    Response.Write "        <input name='Action' type='hidden' id='Action' value='SaveAdd'>"
    Response.Write Submit_Init(" 添 加 ","重新填写","确认要清空对话框内容？","javascript:history.back();","返回上一页")
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
	Response.Write "</div>" & vbCrLf
    Response.Write "</form>"
    Response.Write "</div>"
	Response.Write "<script>" & vbCrLf
	Response.Write "    layui.use('table', function() {" & vbCrLf
	Response.Write "        var table = layui.table;" & vbCrLf
	Response.Write "    })" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub Modify()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>标签管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link rel='stylesheet' type='text/css' href='../Js/Codemirror/Codemirror.css'/>" & vbCrLf
	Response.Write "<link rel='stylesheet' type='text/css' href='../Plugins/editor/css/editormd.min.css'/>" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/Codemirror.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/xml.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/css.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/javascript.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/htmlmixed.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script src='../Js/Codemirror/mirrorframe.js' type='text/javascript'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/editor/editormd.min.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
    Dim LabelID, sqlLabel, rsLabel, LabelIntro2, LabelContent, strTemp, LabelNameTemp
    LabelID = Code_CLng(Trim(Request("LabelID")))
    If LabelID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>参数丢失！</li>"
        Exit Sub
    End If
    sqlLabel = "select * From ["&Data_Name&"] where LabelID=" & LabelID
	Call Exec(rsLabel,sqlLabel,2)
    If rsLabel.BOF And rsLabel.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的标签！</li>"
        rsLabel.Close
        Set rsLabel = Nothing
        Exit Sub
    End If
        
    '解决文本框重复问题
    LabelContent = rsLabel("LabelContent")
    regEx.Pattern = "(\<\/textarea\>)"
    LabelContent = regEx.Replace(LabelContent, "[/textarea]")

    If rsLabel("LabelType") = 1 Or rsLabel("LabelType") = 2 Then
        LabelIntro2 = rsLabel("LabelIntro")
        If InStr(LCase(LabelIntro2), "where") > 0 Then
            regEx.Pattern = "(.*?)\where"
            Set Matches = regEx.Execute(LabelIntro2)
            For Each Match In Matches
                LabelIntro2 = Match.value
				Exit for
            Next
            LabelIntro2 = Trim(Replace(LCase(LabelIntro2), "where", ""))
            regEx.Pattern = "\{input\((.*?)\)\}"
            Set Matches = regEx.Execute(LabelIntro2)
            LabelIntro2 = regEx.Replace(LabelIntro2, "1")
        Else
            regEx.Pattern = "\{input\((.*?)\)\}"
            Set Matches = regEx.Execute(LabelIntro2)
            LabelIntro2 = regEx.Replace(LabelIntro2, "1")
        End If

        Dim i, rs, dbtype
        If InStr(rsLabel("LabelIntro"), "Article") > 0 Then
            dbtype = 1
        ElseIf InStr(rsLabel("LabelIntro"), "Photo") > 0 Then
            dbtype = 2
        ElseIf InStr(rsLabel("LabelIntro"), "Down") > 0 Then
            dbtype = 3
        ElseIf InStr(rsLabel("LabelIntro"), "Shop") > 0 Then
            dbtype = 4
        Else
            dbtype = 0
        End If

        strTemp = "<table class='layui-table table-hover'><tr align='center'>" & vbCrLf
        On Error Resume Next
		Call Exec(rs,LabelIntro2,2)
        If Err.Number <> 0 Then
            Set rs = Nothing
            FoundErr = True
            ErrMsg = ErrMsg & "<li>SQL查询失败，错误原因：" & Err.Description
            Err.Clear
            Exit Sub
        Else
            Err.Clear
            For i = 0 To rs.Fields.Count - 1
                strTemp = strTemp & "<td style=""cursor:pointer;"" onclick=""addfield('" & rs(i).name & "'," & i & "," & dbtype & "," & rs(i).Type & ",'LabelContent')"">" & rs(i).name & "</td>" & vbCrLf
                If (i + 1) Mod 5 = 0 Then
                    strTemp = strTemp & "</tr><tr align='center'>"
                End If
            Next
            Set rs = Nothing
        End If
        strTemp = strTemp & "</tr></table>"
    End If

    Call ShowJSLabel(rsLabel("LabelType"))
    Response.Write "<script language = 'JavaScript'>" & vbCrLf	
    Response.Write "function checkfield(){" & vbCrLf
    Response.Write "    var strtmpp = ""<Div id ='flist2'><table class='layui-table table-hover'><tr align='center'>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist3(0)'>{$Now}</td>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist3(1)'>{$NowDay}</td>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist3(2)'>{$NowMonth}</td>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist3(3)'>{$NowYear}</td>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist3(4)'>{$AutoID}</td>"";" & vbCrLf
    Response.Write "    strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addlist3(5)'>{$totalPut}</td>"";" & vbCrLf
    Response.Write "    var fieldtemp = document.myform.FieldList.value.split(""\n"");" & vbCrLf
    Response.Write "                strtmpp = strtmpp + ""</tr><tr align='center'>"";" & vbCrLf
    Response.Write "        for(i=0;i<fieldtemp.length;i++){" & vbCrLf
    Response.Write "            strtmpp = strtmpp + ""<td style='cursor:pointer;' onclick='addfield2("" + i + "")'>"" + fieldtemp[i] + ""</td>"";" & vbCrLf
    Response.Write "            if(((i+1)%6) == 0){" & vbCrLf
    Response.Write "                strtmpp = strtmpp + ""</tr><tr align='center'>"";" & vbCrLf
    Response.Write "            }" & vbCrLf
    Response.Write "        }" & vbCrLf
    Response.Write "        strtmpp = strtmpp + ""</table><div>"";" & vbCrLf
    Response.Write "        document.getElementById (""flist2"").innerHTML=strtmpp;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrLf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrLf
	Response.Write "        <legend>标签列表</legend>" & vbCrLf
	Response.Write "    </fieldset>" & vbCrLf
	Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrLf
	Response.Write "        <a href=""?Action=AddStat"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加静态标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=AddDyna"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加动态标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=AddDyna&AddType=2"" class=""layui-btn layui-btn-sm""><i class=""fa fa-plus""></i> 添加函数标签</a>" & vbCrLf
	Response.Write "        <a href=""?Action=Main"" class=""layui-btn layui-btn-sm"
	If ListType=0 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 静态标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "        <a href=""?Action=Main&ListType=1"" class=""layui-btn layui-btn-sm"
	If ListType=1 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 动态标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "        <a href=""?Action=Main&ListType=2"" class=""layui-btn layui-btn-sm"
	If ListType=2 Then Response.Write " layui-btn-danger"
	Response.Write """>" & vbCrlf
	Response.Write "            <i class=""fa fa-file-code-o""></i> 函数标签" & vbCrlf
	Response.Write "        </a>" & vbCrlf
	Response.Write "    </blockquote>" & vbCrLf
	Response.Write "    <br>" & vbCrLf
    Response.Write "<form action='" & strFileName & "' method='post' name='myform' id='myform' onSubmit='return CheckForm();'>"
    Response.Write "<div class=""table-responsive"">" & vbCrLf
	Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "    <tr class='title' height='30'>"
    If rsLabel("LabelType") = 0 Then
        Response.Write "      <td  align='center'><strong>修 改 静 态 标 签</strong></td>"
    ElseIf rsLabel("LabelType") = 1 Then
        Response.Write "      <td  align='center'><strong>修 改 动 态 标 签</strong></td>"
    ElseIf rsLabel("LabelType") = 2 Then
        Response.Write "      <td  align='center'><strong>修 改 动 态 函 数 标 签</strong></td>"
    End If
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签名称：</strong></td>"
    If Left(rsLabel("LabelName"), 3) = "WK_" Then
        LabelNameTemp = Right(rsLabel("LabelName"), Len(rsLabel("LabelName")) - 3)
    Else
        LabelNameTemp = rsLabel("LabelName")
    End If
    Response.Write "          <td>{$WK_<input name='LabelName' type='text' id='LabelName' size='30' maxlength='50' value='" & LabelNameTemp & "'>}"
    Response.Write "          <td width='10'></td>"
    Response.Write "          <td><font color='#FF0000'>* 输入名称（英文要注意大小写）即可，不用输入定界符。</font></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签分类：</strong></td>"
    Response.Write "          <td colspan='3'><input name='LabelClass' type='text' id='LabelClass' size='30' maxlength='50' value='" & rsLabel("LabelClass") & "'> " & getlabelclass(rsLabel("LabelType")) & "</td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    If rsLabel("LabelType") = 1 Or rsLabel("LabelType") = 2 Then
        Response.Write "    <tr>"
        Response.Write "      <td>"
        Response.Write "<table class='layui-table table-hover'>" & vbCrlf
        Response.Write "        <tr>"
        Response.Write "          <td width='100' align='center'><strong>分页数量：</strong></td>"
        Response.Write "          <td width='45'><input name='pagenum' type='text' id='pagenum' size='3' maxlength='5' value=" & rsLabel("PageNum") & "></td>"
        Response.Write "          <td width='10'></td><td><font color='#FF0000'>* 动态标签分页显示的每页显示数,为0时则不分页。</font></td>"
        Response.Write "        </tr>"
        Response.Write "       </table>"
        Response.Write "      </td>"
        Response.Write "    </tr>"
        Response.Write "    <tr>"
        Response.Write "      <td>"
        Response.Write "<table class='layui-table table-hover'>" & vbCrlf
        Response.Write "        <tr>"
        Response.Write "          <td width='100' align='center'><strong>自动刷新：</strong></td>"
        Response.Write "          <td width='45'><input name='rtime' type='text' id='rtime' size='3' maxlength='3' value=" & rsLabel("reFlashTime") & "></td>"
        Response.Write "          <td width='10'></td><td><font color='#FF0000'>* 标签内容自动刷新频率，必须大于10秒并启用分页功能才能启动。</font></td>"
        Response.Write "        </tr>"
        Response.Write "       </table>"
        Response.Write "      </td>"
        Response.Write "    </tr>"
    End If
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "<table class='layui-table table-hover'>" & vbCrlf
    Response.Write "        <tr>"
    If rsLabel("LabelType") = 0 Then
        Response.Write "         <td width='100' align='center'><strong>标签简介：</strong></td>"
    ElseIf rsLabel("LabelType") = 1 Or rsLabel("LabelType") = 2 Then
        Response.Write "         <td width='100' align='center'><strong>查询语句：</strong></td>"
    End If
    Response.Write "         <td><textarea name='LabelIntro' cols='96' rows='4' id='LabelIntro'>" & rsLabel("LabelIntro") & "</textarea></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
	
    If rsLabel("LabelType") = 2  Then
        Response.Write "<tr>"
        Response.Write "      <td>"
        Response.Write "<table class='layui-table table-hover'>" & vbCrlf
        Response.Write "        <tr>"
        Response.Write "          <td width='100' align='center'><strong>参数说明：</strong></td>"
        Response.Write "          <td width='80'><textarea name='FieldList' cols='40' rows='5' id='FieldList'onkeydown=""checkfield();"">"
        Dim arrFieldList
        arrFieldList = Split(rsLabel("FieldList"), "|||")
		For i = 0 To UBound(arrFieldList)
            If Trim(arrFieldList(i)) <> "" and i<>UBound(arrFieldList) Then
                Response.Write arrFieldList(i) & vbCrLf
            else
                Response.Write arrFieldList(i)
            End If
        Next
		Response.Write "</textarea></td>"
        Response.Write "          <td width='10'></td><td><font color='#FF0000'>* 输入函数列表参数,每行一个。</font></td>"
        Response.Write "        </tr>"
        Response.Write "       </table>"
        Response.Write "      </td>"
        Response.Write "    </tr></tbody>"
    End If

    If rsLabel("LabelType") = 1 Or rsLabel("LabelType") = 2 Then
        Response.Write "<script language = 'JavaScript'>" & vbCrLf
        Response.Write "function CssInsertCode(Val,Content) {" & vbCrLf
		Response.Write "if(Val != """" && Val != null){" & vbCrlf
		Response.Write "LabelContent.replaceSelection(Val,LabelContent.getCursor());" & vbCrlf
		Response.Write "LabelContent.focus()" & vbCrlf
		Response.Write "}" & vbCrLf
		Response.Write "}" & vbCrLf
        Response.Write "function addlist3(input){" & vbCrLf
        Response.Write "    if (input == 0){" & vbCrLf
        Response.Write "        CssInsertCode(""{$Now}"",""LabelContent"");" & vbCrLf
        Response.Write "    }" & vbCrLf
        Response.Write "    if (input == 1){" & vbCrLf
        Response.Write "        CssInsertCode(""{$NowDay}"",""LabelContent"");" & vbCrLf
        Response.Write "    }" & vbCrLf
        Response.Write "    if (input == 2){" & vbCrLf
        Response.Write "        CssInsertCode(""{$NowMonth}"",""LabelContent"");" & vbCrLf
        Response.Write "    }" & vbCrLf
        Response.Write "    if (input == 3){" & vbCrLf
        Response.Write "        CssInsertCode(""{$NowYear}"",""LabelContent"");" & vbCrLf
        Response.Write "    }" & vbCrLf
        Response.Write "    if (input == 4){" & vbCrLf
        Response.Write "        CssInsertCode(""{$AutoID}"",""LabelContent"");" & vbCrLf
        Response.Write "    }" & vbCrLf
        Response.Write "    if (input == 5){" & vbCrLf
        Response.Write "        CssInsertCode(""{$totalPut}"",""LabelContent"");" & vbCrLf
        Response.Write "    }" & vbCrLf
        Response.Write "}" & vbCrLf
        Response.Write "</script>" & vbCrLf
        Response.Write "    <tr>"
        Response.Write "      <td>"
        Response.Write "<table class='layui-table table-hover'>" & vbCrlf
        Response.Write "        <tr>"
        Response.Write "          <td width='100' align='center'><strong>标签列表：</strong></td>" & vbCrLf
        Response.Write "          <td>" & strTemp & "</td>"
        Response.Write "        </tr>"
        Response.Write "       </table>"
        Response.Write "      </td>"
        Response.Write "    </tr>"
        strTemp = "<div id='flist2'><table class='layui-table table-hover'><tr align='center'>" & vbCrLf
        strTemp = strTemp & "<td style='cursor:pointer;' onclick='addlist3(0)'>{$Now}</td>"
        strTemp = strTemp & "<td style='cursor:pointer;' onclick='addlist3(1)'>{$NowDay}</td>"
        strTemp = strTemp & "<td style='cursor:pointer;' onclick='addlist3(2)'>{$NowMonth}</td>"
        strTemp = strTemp & "<td style='cursor:pointer;' onclick='addlist3(3)'>{$NowYear}</td>"
        strTemp = strTemp & "<td style='cursor:pointer;' onclick='addlist3(4)'>{$AutoID}</td>"
        strTemp = strTemp & "<td style='cursor:pointer;' onclick='addlist3(5)'>{$totalPut}</td></tr>"
        If rsLabel("LabelType") = 2 And rsLabel("FieldList") <> "" Then
            strTemp = strTemp & "<tr align='center'>"
            For i = 0 To UBound(arrFieldList)
               If Trim(arrFieldList(i)) <> "" Then
                    strTemp = strTemp & "<td style=""cursor:pointer;"" onclick=""addfield2(" & i & ")"">" & arrFieldList(i) & "</td>" & vbCrLf
                    If (i + 1) Mod 6 = 0 Then
                        strTemp = strTemp & "</tr><tr align='center'>"
                    End If
                End If
            Next
            strTemp = strTemp & "</tr>"
        End If
        strTemp = strTemp & "</table><div>"
        Response.Write "    <tr>"
        Response.Write "      <td>"
        Response.Write "<table class='layui-table table-hover'>" & vbCrlf
        Response.Write "        <tr>"
        Response.Write "          <td width='100' align='center'><strong>参数列表：</strong></td>" & vbCrLf
        Response.Write "          <td>" & strTemp & "</td>"
        Response.Write "        </tr>"
        Response.Write "       </table>"
        Response.Write "      </td>"
        Response.Write "    </tr>"
    End If
    Response.Write "    <tr>"
    Response.Write "      <td>"
    Response.Write "       <table border='0' cellpadding='0' cellspacing='0' width='100%'>"
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>优 先 级：</strong></td>"
    Response.Write "          <td><input name='Priority' type='text' id='Priority' size='5' maxlength='5' value='" & rsLabel("Priority") & "'></td>"
    Response.Write "          <td width='10'></td>"
    Response.Write "          <td><font color='#FF0000'>数字越小，优先级越高。当标签中再嵌套调用其他标签时，就需要决定标签的优先级。<br>系统按照如下顺序来替换标签：自定义标签-->系统通用标签-->模型标签</font></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "     <td>"
    Response.Write "       <table border='0' cellpadding='0' cellspacing='0' width='100%'>"
    Response.Write "        <tr>"
    Response.Write "          <td width='100' align='center'><strong>标签内容：</strong></td>"
    Response.Write "          <td><div id=""editormd""></div><textarea id='LabelContent' name='LabelContent' style=""display:none;"">" & LabelContent & "</textarea></td>"
    Response.Write "        </tr>"
    Response.Write "       </table>"
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "LabelContent = editormd(""editormd"", {" & vbCrLf
	Response.Write "	width : ""100%""," & vbCrLf
	Response.Write "	height : ""300px""," & vbCrLf
	Response.Write "	watch : false," & vbCrLf
	Response.Write "	toolbar : false," & vbCrLf
	Response.Write "	codeFold : true," & vbCrLf
	Response.Write "	searchReplace : true," & vbCrLf
	Response.Write "	placeholder : ""请输入html代码""," & vbCrLf
	Response.Write "	value : document.getElementById(""LabelContent"").value," & vbCrLf
	Response.Write "	theme : ""default""," & vbCrLf
	Response.Write "	mode : ""text/html""," & vbCrLf
	Response.Write "	path : '../Plugins/editor/lib/'" & vbCrLf
	Response.Write "});" & vbCrLf
	Response.Write "</script>" & vbCrLf
    Response.Write "     </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td height='40'  align='center'><input name='LabelID' type='hidden' id='LabelID' value='" & LabelID & "'>"
    Response.Write "        <input name='LabelType' type='hidden' id='LabelType' value=" & rsLabel("LabelType") & ">"
    Response.Write "        <input name='Action' type='hidden' id='Action' value='SaveModify'>"
    Response.Write Submit_Init(" 保存修改结果 ","重新填写","确认要清空对话框内容？","javascript:history.back();","返回上一页")
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
	Response.Write "</div>" & vbCrLf
    Response.Write "</form>"
    Response.Write "</div>"
	Response.Write "<script>" & vbCrLf
	Response.Write "    layui.use('table', function() {" & vbCrLf
	Response.Write "        var table = layui.table;" & vbCrLf
	Response.Write "    })" & vbCrLf
	Response.Write "</script>" & vbCrLf
    rsLabel.Close
    Set rsLabel = Nothing
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub Save()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>标签管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
    Dim LabelID, LabelName, LabelClass, LabelIntro, LabelIntro2, Priority, LabelContent, LabelType, PageNum, RTime, SystemLabelName
    Dim rsLabel, sqlLabel, trs, i, FieldList, Scode
    LabelID = Code_CLng(Trim(Request.Form("LabelID")))
    LabelName = Trim(Request.Form("LabelName"))
    LabelClass = Trim(Request.Form("LabelClass"))
    LabelIntro = Trim(Request.Form("LabelIntro"))
    Priority = Trim(Request.Form("Priority"))
    LabelContent = Trim(Request.Form("LabelContent"))
    LabelType = Code_CLng(Trim(Request.Form("LabelType")))
    PageNum = Code_CLng(Trim(Request.Form("pagenum")))
    RTime = Code_CLng(Trim(Request.Form("rtime")))
    Scode = Trim(Request.Form("Scode"))
	FieldList = Request.Form("FieldList")
    If Action = "SaveModify" Then
        If LabelID = 0 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定LabelID</li>"
            Exit Sub
        End If
    End If

    If LabelName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>标签名称不能为空！</li>"
    Else
        LabelName = ReplaceBadChar(LabelName)
        If Left(LabelName, 3) <> "WK_" Then
        LabelName = "WK_" & LabelName
        End If
        If Action = "SaveModify" Then
			Call Exec(trs,"select * From ["&Data_Name&"] where LabelID<>" & LabelID & " and LabelName='" & LabelName & "'",2)
        Else
			Call Exec(trs,"select * From ["&Data_Name&"] where LabelName='" & LabelName & "'",2)
        End If
        If Not (trs.BOF And trs.EOF) Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>指定的标签名称已经存在！</li>"
        End If
        Set trs = Nothing
    End If
    
    If LabelType = "" Then
        LabelType = 0
    Else
        LabelType = Code_CLng(LabelType)
    End If

    If LabelType = 1 Or LabelType = 2 Then
        If LabelIntro = "" Then
            FoundErr = True
            ErrMsg = ErrMsg & "<br><li>查询语句不能为空！</li>"
        Else
            If Left(LCase(LabelIntro), 6) <> "select" Then
                FoundErr = True
                ErrMsg = ErrMsg & "<br><li>只能使用查询语句！</li>"
            End If
            If InStr(LCase(LabelIntro), "admin") > 0 Or InStr(LCase(LabelIntro), "config") > 0 Then
                FoundErr = True
                ErrMsg = ErrMsg & "<br><li>出于安全目的本功能禁止对管理员及系统设置的查询！</li>"
            End If
        End If
 
        If InStr(LCase(LabelIntro), "where") > 0 Then
            regEx.Pattern = "(.*?)\where"
            Set Matches = regEx.Execute(LabelIntro)
            For Each Match In Matches
                 LabelIntro2 = Match.value
                 Exit For
            Next
            LabelIntro2 = Trim(Replace(LCase(LabelIntro2), "where", ""))
            regEx.Pattern = "\{input\((.*?)\)\}"
            Set Matches = regEx.Execute(LabelIntro2)
            LabelIntro2 = regEx.Replace(LabelIntro2, "1")
        Else
            regEx.Pattern = "\{input\((.*?)\)\}"
            Set Matches = regEx.Execute(LabelIntro)
            LabelIntro2 = regEx.Replace(LabelIntro, "1")
        End If



        On Error Resume Next
		Call Exec(trs,LabelIntro2,2)
        If Err.Number <> 0 Then
            Set trs = Nothing
            FoundErr = True
            ErrMsg = ErrMsg & "<li>SQL查询失败，错误原因：" & Err.Description
            Err.Clear
            Exit Sub
        End If
        Set trs = Nothing
    End If
    
    If LabelContent = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>标签内容不能为空！</li>"
    End If
    
    If Priority = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>优先级不能为空！</li>"
    Else
        Priority = Code_CLng(Priority)
        If Priority <= 0 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>优先级必须大于0！</li>"
        End If
    End If
    
    If InStr(LabelContent, LabelName&"(") > 0 or InStr(LabelContent, LabelName&"}") > 0 Then '自定义标签{$WK_标签名}的标签内容可以包含{$WK_标签名**}这样的标签.
        FoundErr = True
        ErrMsg = ErrMsg & "<li>自定义标签不能自己包括自己！</li>"
    End If
    
    If InStr(LabelContent, "<body>") > 0 Or InStr(LabelContent, "<html>") > 0 Or InStr(LabelContent, "</html>") > 0 Or InStr(LabelContent, "</body>") > 0 Or InStr(LabelContent, "<head>") > 0 Or InStr(LabelContent, "</head>") > 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>自定义标签不能包含&lt;html&gt;&nbsp;,&lt;body&gt;,&lt;/body&gt;,&lt;/html&gt;等！！！</li>"
    End If

    Dim NullBody, strTemp, strTemp2, Match2
   '使用正则 分别过滤调编辑模板中的图片
     
    regEx.Pattern = "(\<body)(.[^\<]*)(\>)"
    Set Matches = regEx.Execute(LabelContent)
    For Each Match In Matches
        NullBody = Match.value
    Next

    
    If NullBody <> "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>自定义标签不能包含&lt;html&gt;&nbsp;,&lt;body&gt;,&lt;/body&gt;,&lt;/html&gt;等！！！</li>"
    End If
    
    If FoundErr = True Then Exit Sub

    Dim rscai, Code, StringReplace, LableStart, LableEnd, UpFileType, FilterProperty
    Dim Script_Iframe, Script_Object, Script_Script, Script_Class, Script_Div, Script_Span, Script_Img, Script_Font, Script_A, Script_Html, Script_Table, Script_Tr, Script_Td
    Dim ReplaceNum, AreaCode

    If Action = "SaveModify" Then
        sqlLabel = "select * From ["&Data_Name&"] where LabelID=" & LabelID
        Call Exe_Conn(rsLabel,sqlLabel,3)
        rsLabel("LabelName") = LabelName
        rsLabel("LabelClass") = LabelClass
        rsLabel("LabelIntro") = LabelIntro
        rsLabel("PageNum") = PageNum
        rsLabel("reFlashTime") = RTime
        rsLabel("LabelContent") = LabelContent
        rsLabel("Priority") = Priority
        If LabelType = 2 Then
            FieldList = Request.Form("FieldList")
            Dim arrFieldList, FieldList2
            arrFieldList = Split(FieldList, vbCrLf)
            For i = 0 To UBound(arrFieldList)
                If Trim(arrFieldList(i)) <> "" Then
                    FieldList2 = FieldList2 & arrFieldList(i) & "|||"
                End If
            Next
            rsLabel("fieldlist") = FieldList2
        End If
        rsLabel.Update
        rsLabel.Close
        Set rsLabel = Nothing
        Response.Write IsSuccess("修改自定义标签成功！",AdminFolder & "/Admin/"&strFileName)
    Else
        If LabelType > 0 Then
			Call Exec(rscai,"Select count(LabelID) From ["&Data_Name&"] Where LabelType=" & LabelType,2)
            If rscai(0) > 30 And SystemDatabaseType = 0 Then
                Set rscai = Nothing
                FoundErr = True
                ErrMsg = ErrMsg & "<li>您添加的本类型标签已经超过服务器负载能力，请删除不常用的标签再添加！</li>"
                Exit Sub
            End If
        End If
		LabelID = GetNewID(Data_Name, "LabelID")
        sqlLabel = "select top 1 * From ["&Data_Name&"]"
		Call Exe_Conn(rsLabel,sqlLabel,3)
        rsLabel.addnew
		rsLabel("LabelID") = LabelID
        rsLabel("LabelName") = LabelName
        rsLabel("LabelClass") = LabelClass
        rsLabel("LabelIntro") = LabelIntro
        rsLabel("PageNum") = PageNum
        rsLabel("reFlashTime") = RTime
        rsLabel("FieldList") = FieldList	
        rsLabel("LabelContent") = LabelContent
        rsLabel("Priority") = Priority
        rsLabel("LabelType") = LabelType
        rsLabel("AreaCollectionID") = 0
        rsLabel.Update
        rsLabel.Close
        Set rsLabel = Nothing
        Response.Write IsSuccess("保存自定义标签成功！",AdminFolder & "/Admin/"&strFileName)
    End If
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub ListOrder()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		ID = Code_CLng(Trim(Code_Form("ID")))
		ListType = Code_CLng(Trim(Code_Form("ListType")))
		ClassType = ReplaceBadChar(Trim(Code_Form("ClassType")))
		Priority = Code_CLng(Trim(Code_Form("sort")))
		Call Exec("","Update ["&Data_Name&"] Set Priority="&Priority&" Where LabelID="&ID,0)
		Response.Write "{""msg"":""\u6392\u5e8f\u6210\u529f\uff01"",""url"":""?ListType="&ListType&"&ClassType="&ClassType&""",""code"":1}"
		Response.End()
	End If
End Sub

Sub DelLabel()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Dim LabelID, sqlLabel, rsLabel, tLabelContent, ListType
		LabelID = Code_CLng(Trim(Code_Form("ID")))
		ListType = Code_CLng(Trim(Code_Form("ListType")))
		If LabelID = 0 Then
			Response.Write "{""msg"":""\u53c2\u6570\u4e22\u5931\uff01"",""code"":0}"
			Response.End()
			Exit Sub
		End If
		sqlLabel = "select * From ["&Data_Name&"] where LabelID=" & LabelID
		Call Exe_Conn(rsLabel,sqlLabel,3)
		If rsLabel.BOF And rsLabel.EOF Then
			Response.Write "{""msg"":""\u627e\u4e0d\u5230\u6307\u5b9a\u7684\u6807\u7b7e\uff01"",""code"":0}"
			Response.End()
			rsLabel.Close
			Set rsLabel = Nothing
			Exit Sub
		End If
		rsLabel.Delete
		rsLabel.Update
		rsLabel.Close
		Set rsLabel = Nothing
		Call CloseConn()
		Response.Write "{""msg"":""\u5220\u9664\u6210\u529f\uff01"",""code"":1}"
		Response.End()
	End If
End Sub

Function getlabelclass(itype)
    If itype = "" Then
        getlabelclass = ""
    Else
        Dim strtmp, rsClass
		strtmp = "<div id=""LabelClassList_outer"" ztype=""select"" class=""z-combox"" style=""display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;height:auto;width:auto;position:relative;border:none 0;margin:0;padding:0;white-space: nowrap;"" _style=""width:100px;""><input type=""text"" ztype=""select"" id=""LabelClassList"" name=""LabelClassList"" tabindex=""-1"" autocomplete=""off"" class=""inputText"" style=""width:100px;position:absolute;z-index:-1;"" onchange=""addclass()"" value="""" startvalue=""""/><input type=""text"" id=""LabelClassList_textField"" autocomplete=""off"" class=""inputText"" style=""vertical-align:middle; cursor:default;width:100px;"" /><a id=""LabelClassList_spinner"" class=""z-combox-spinner"" style=""position:relative; left:-17px; margin-right:-15px; cursor:pointer; width:13px; height:15px;vertical-align:middle;""><b></b></a><div id=""LabelClassList_list"" class=""optgroup"" style=""text-align:left;display:none;""><div id=""LabelClassList_ul"" style=""left:-1px; width:-1px;""><script>Combox_LabelClassList_Init=function(){var _el=Zving.getDom('LabelClassList');if(_el._components){return true;}var  _data=[];var  _DataSource;"
		strtmp = strtmp & "_data.push(['','新增分类']);"
		Call Exec(rsClass,"select LabelClass From ["&Data_Name&"] Where LabelType=" & itype & " GROUP BY LabelClass",2)
        Do While Not rsClass.EOF
            If Trim(rsClass(0) & "") <> "" Then
                strtmp = strtmp & "_data.push(['" & rsClass(0) & "','" & rsClass(0) & "']);"
            End If
            rsClass.MoveNext
        Loop
        Set rsClass = Nothing
        strtmp = strtmp & "var combox_LabelClassList = new Zving.Selector({el:_el,data:_data,DataSource:_DataSource});};if(Zving.Page.isReady){Combox_LabelClassList_Init();}else{Zving.Page.onReady(Combox_LabelClassList_Init);}</script></div></div></div>"
        getlabelclass = strtmp
    End If
End Function
%>